<%--
  Created by IntelliJ IDEA.
  User: 123
  Date: 2021/5/31
  Time: 16:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width" />
    <meta name="author" content="www.yanshisan.cn" />
    <meta name="robots" content="all" />
    <title>写博客</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/layui/css/layui.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/css/master.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/css/gloable.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/css/nprogress.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/page/css/message.css" />
    <script type="text/javascript" src="../../Static-Resources/js/jquery-3.4.1.js"></script>
</head>
<body>
<div class="header">
</div>
<header class="gird-header">
    <div class="header-fixed">
        <div class="header-inner">
            <a href="javascript:void(0)" class="header-logo" id="logo">Mr.Yss</a>
            <nav class="nav" id="nav">
                <ul>
                    <li><a href="${pageContext.request.contextPath}/article">博客</a></li>
                    <li><a href="${pageContext.request.contextPath}/message">留言</a></li>
                    <li><a href="${pageContext.request.contextPath}/article/write">写博客</a></li>
                </ul>
            </nav>
            <a href="#" class="blog-user">
                <i class="fa fa-qq"></i>
            </a>
            <a class="phone-menu">
                <i></i>
                <i></i>
                <i></i>
            </a>
        </div>
    </div>
</header>
<div class="doc-container" id="doc-container">
    <div class="container-fixed" >
        <div class="container-inner" >
            <section class="msg-remark">
                <h1>写博客</h1>
                <p>
                    乐于分享，日善一事！
            </section>
            <div class="textarea-wrap message" id="textarea-wrap">
                <form action="#">
                    <textarea name="oopl" id="remarkEditortitle" placeholder="请输入标题" style="height: 30px;width: 200px;border:1px black solid" ></textarea>
                    <textarea name="editorContent" lay-verify="content" id="remarkEditor" placeholder="请输入内容" class="layui-textarea layui-hide"></textarea>

                </form>
                <button type="button" class="layui-btn" id="oop" onclick="sub()" >提交博客</button>
            </div>
        </div>
    </div>
</div>
<footer class="grid-footer">
    <div class="footer-fixed">
        <div class="copyright">
            <div class="info">
                <div class="contact">
                    <a href="javascript:void(0)" class="github" target="_blank"><i class="fa fa-github"></i></a>
                    <a href="#" class="qq" target="_blank" ><i class="fa fa-qq"></i></a>
                    <a href="#" class="email" target="_blank" ><i class="fa fa-envelope"></i></a>
                    <a href="javascript:void(0)" class="weixin"><i class="fa fa-weixin"></i></a>
                </div>
                <p class="mt05">

                </p>
            </div>
        </div>
    </div>
</footer>
<script src="${pageContext.request.contextPath}/page/layui/layui.js"></script>
<script src="${pageContext.request.contextPath}/page/js/yss/gloable.js"></script>
<script src="${pageContext.request.contextPath}/page/js/plugins/nprogress.js"></script>
<script>NProgress.start();</script>
<script>
    window.onload = function () {
        NProgress.done();
    };
</script>
<script type="text/javascript">
    var area;
    var editIndex;
    var layedit;
    layui.use(['element', 'jquery', 'form', 'layedit', 'flow'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.jquery;
        layedit = layui.layedit;
        var flow = layui.flow;
        editIndex = layedit.build('remarkEditor', {
            height: 350,
            tool: ['face', '|', 'link'],
        });
    });

    function sub(){
    function getData() {
        var json={
            artTitle: $('#remarkEditortitle').val(),
            artLinks: layedit.getContent(editIndex)
        }
        return json;
    }
    $.ajax({
            type:'get',
            dataType:'json',
            url:"${pageContext.request.contextPath}/article/add",
            data :{"article" : JSON.stringify(getData())},
            contentType: "application/json"
        }
    );
    $(location).attr('href',"${pageContext.request.contextPath}/article");
    }
</script>
</body>
</html>

